<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>对象</title>
		<script>
			class Animal{
				constructor(name,age,sex){
					this.name=name;
					this.age=age;
					this.sex=sex;
				}
				run(){
					alert(this.name+"在跑!他今年"+this.age+"岁了，性别是"+this.sex);
				}
				guonian(){
					this.age++;
				}
			}
			
			class Bird extends Animal{
				constructor(name,age,sex,pinzhong){
					super(name,age,sex);
					this.type=pinzhong;
				}
				show(){
					alert(this.name+","+this.age+","+this.sex+","+this.type);
				}
				//重写
				run(){
					//super.run();
					alert(this.name+"在飞行!他今年"+this.age+"岁了，性别是"+this.sex);
				}
				fly(){
					alert(this.name+"飞走了");
				}
			}
			var y=new Bird("翠花",1,"绿色","鹦鹉");
			y.show();
			y.run();
			y.fly();
			alert("过年了");
			y.guonian();
			y.show();
			// var a=new Animal("大黄",4,"黄");
			// a.run();
			// a.guonian();
			// a.run();
		</script>
	</head>
	<body>
	</body>
</html>